package cn.lk.netty.rpc;

import cn.lk.netty.rpc.bean.Request;
import com.alibaba.fastjson.JSON;
import java.io.Serializable;

import java.util.Arrays;

public class TestJson {

    public static void main(String[] args) {
        String str = "{\"parameterTypes\":[\"ls.ddz.db.model.UserInfo\"]," +
                "\"methodName\":\"insertInfoUser\",\"className\":\"cn.lk.netty.rpc.service.InfoUserService\"," +
                "\"id\":\"7935386766086250497\",\"parameters\":[{\"address\":\"BeiJing\",\"name\":\"Jeen\"," +
                "\"id\":\"7935386766086250496\"}]}";
        Request2 request = JSON.parseObject(str, Request2.class);
        System.out.println(Arrays.toString(request.getParameterTypes()));
    }

}

class Request2 implements Serializable {
    private String id;
    private String className;// 类名
    private String methodName;// 函数名称
    private Class<?>[] parameterTypes;// 参数类型
    private Object[] parameters;// 参数列表

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public String getClassName() {
        return className;
    }

    public void setClassName(String className) {
        this.className = className;
    }

    public String getMethodName() {
        return methodName;
    }

    public void setMethodName(String methodName) {
        this.methodName = methodName;
    }

    public Class<?>[] getParameterTypes() {
        return parameterTypes;
    }

    public void setParameterTypes(Class<?>[] parameterTypes) {
        this.parameterTypes = parameterTypes;
    }

    public Object[] getParameters() {
        return parameters;
    }

    public void setParameters(Object[] parameters) {
        this.parameters = parameters;
    }
}